// components/dp-header/dp-header.js
Component({
  properties: {
    disabled: {
      type: Boolean,
      value: false // 默认不禁用
    },
    searchText: String
  },
  methods: {
    clickSearch() {
      if (this.data.disabled) {
        // 禁用状态下跳转搜索页
        wx.navigateTo({
          url: '/pages/search/search',
        });
      } else {
        // 非禁用状态触发 onSearch 事件
        this.triggerEvent('onSearch');
      }
    },
    onInput(e) {
      this.triggerEvent('onInput', e.detail);
    },
    
    onSearch() {
      this.triggerEvent('onSearch');
    },

    onClear(){
      this.triggerEvent('onClear');
    }
  }
});